/*
 * CategoryListItem.java
 * business
 *
 * Created by SunDing on 2016/9/9.
 *
 * Copyright (c) 2016年 yidiandao. All rights reserved.
 */

package com.yidiandao.business.ui.widget.listview.displaylistitem;

import android.content.Context;
import android.support.v4.util.ArrayMap;

import com.yidiandao.business.R;
import com.yidiandao.business.ui.widget.listview.DisplayListItem;
import com.yidiandao.business.ui.widget.listview.viewholder.CategoryListHolder;
import com.yidiandao.business.utils.UIUtils;

/** 首页 分类 */
public class CategoryListItem extends DisplayListItem<CategoryListHolder, ArrayMap<String, String>> {

    public CategoryListItem(ArrayMap<String, String> s) {
        super(s);
    }

    @Override
    public void onShow(Context context, CategoryListHolder holder) {
        String tag = data.get("check"); //1选中  0 未选中
        if (tag.equals("0")) {
            holder.mRlBgCategory.setBackgroundColor(UIUtils.getColor(R.color.white));
            holder.mTvCategoryName.setTextColor(UIUtils.getColor(R.color.text_color_3));
            holder.mViewCategory.setSelected(false);
        } else {
            holder.mRlBgCategory.setBackgroundColor(UIUtils.getColor(R.color.bg_page));
            holder.mTvCategoryName.setTextColor(UIUtils.getColor(R.color.colorSelector));
            holder.mViewCategory.setSelected(true);
        }
        holder.mTvCategoryName.setText(data.get("name"));
    }

    @Override
    public String getDisplayItemTag() {
        return CategoryListItem.class.getSimpleName();
    }

    @Override
    public Class<CategoryListHolder> getViewHolderClazz() {
        return CategoryListHolder.class;
    }
}
